<div class="widget-head" style="margin-top:0;">
    <div class="widget-title">权限角色</div>
</div>
<div class="layui-clear">
    <a class="layui-btn fl" href="javascript:;" style="margin-left:0" onclick="think_open('/permission/admin/edit_role','新增角色',['500px','400px'],0)">新增角色</a>
</div>
<table id="list" lay-skin="line"></table>
<script type="text/html" id="barDemo">
    <div class="action-btn">
        <a href="javascript:;" onclick="think_open('/permission/admin/edit_role/id/{{d.id}}','编辑',['500px','400px'],0)">编辑</a>
        <a href="javascript:;" onclick="think_open('/permission/admin/permission/id/{{d.id}}','【{{d.name}}_{{d.desc}}】_分配权限',['500px','90%'],0)">分配权限</a>
        <a class="mini_del" href="javascript:;" data-url="/permission/api_admin/del/ids/{{d.id}}">删除</a>
    </div>
</script>

<script>
    layui.use(['think'], function() {
        var think = layui.think;
        think.render({
            elem: '#list',
            skin: 'line',
            // height: 500,
            url: '/permission/api_admin/getdata_role',
            page: true,
            size: 'lg',
            // toolbar: true,
            cols: [
                [ //表头
                    {
                        type: 'checkbox',
                    }, {
                        field: 'id',
                        title: 'ID',
                        width: 60
                    }, {
                        field: 'name',
                        title: '角色名'
                    }, {
                        field: 'desc',
                        title: '角色描述'
                    }, {
                        field: 'listorder',
                        title: '排序',
                        width: 80
                    }, {
                        field: 'create_time',
                        title: '创建时间',
                        width: 170,
                        templet: function(d) {
                            return think_time(d.create_time, 'Y-m-d H:i:s'); //think_time()是think.js里面的方法
                        }
                    }, {
                        title: '操作',
                        width: 180,
                        align: 'center',
                        toolbar: '#barDemo'
                    }
                ]
            ]
        }, '{$_GET["searchtype"]}', '{$_GET["keywords"]}');
    });
</script>